#ifndef HTTP_RESPONSE_HEADER_H
#define HTTP_RESPONSE_HEADER_H

#include "HttpHeader.h"
namespace fx {

    FX_DECLARE_CLASS(HttpResponseHeader);

    class HttpResponseHeader
        : public HttpHeader
    {
    public:
        virtual ~HttpResponseHeader();

        static HttpResponseHeaderPtr Create();
        static HttpResponseHeaderPtr Create(const std::string& str_buf);
        static HttpResponseHeaderPtr Create(std::istream& iss);

        const std::string& GetProtocol() const { return protocol_; }
        const std::string& GetVersion() const { return version_; }
        const std::string& GetCode() const { return code_; }
        const std::string& GetDescription() const { return description_; }

        void SetProtocol(const std::string& protocol);
        void SetVersion(const std::string& version);
        void SetCode(const std::string& code);
        void SetDescription(const std::string& description);

    protected:
        HttpResponseHeader();

        virtual bool ParseFirstLine();
        virtual void UpdateFirstLine();

    protected:
        std::string protocol_;
        std::string version_;
        std::string code_;
        std::string description_;
        bool need_update_;
    };
}

#endif//HTTP_RESPONSE_HEADER_H
